﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

internal class MessageBoxEx
{
    const string caption = "Pomina!";

    #region Dialogs
    internal static bool? ShowQuestion(string message, params object[] param)
    {
        if (param != null && param.Count() > 0) message = String.Format(message, param);
        DialogResult result = MessageBox.Show(message, caption, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

        if (result == DialogResult.Yes) { return true; }
        else if (result == DialogResult.No) { return false; }

        return null;
    }

    internal static bool ShowYesNoQuestion(string message, params object[] param)
    {
        if (param != null && param.Count() > 0) message = String.Format(message, param);
        DialogResult result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

        return result == DialogResult.Yes;
    }

    internal static bool ShowOKCancelQuestion(string message, params object[] param)
    {
        if (param != null && param.Count() > 0) message = String.Format(message, param);
        DialogResult result = MessageBox.Show(message, caption, MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

        return result == DialogResult.OK;
    }

    internal static void ShowAlert(string message, params object[] param)
    {
        if (param != null && param.Count() > 0) message = String.Format(message, param);
        DialogResult result = MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
    }

    internal static void ShowSuccessful(string message, params object[] param)
    {
        if (param != null && param.Count() > 0) message = String.Format(message, param);
        DialogResult result = MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
    } 
    #endregion

    #region Windows
    internal static void ShowInfoToolTip(Control control, string message)
    {
        ShowInfoToolTip(control, message, ToolTipIcon.Info);
    }
    internal static void ShowInfoToolTip(Control control, string message, ToolTipIcon toolTipIcon)
    {
        ShowInfoToolTip(control, message, ToolTipIcon.Info, System.Drawing.Color.LightYellow, System.Drawing.Color.Red);
    }
    internal static void ShowInfoToolTip(Control control, string message, ToolTipIcon toolTipIcon, System.Drawing.Color backColor, System.Drawing.Color foreColor)
    {
        ToolTip Tooltip1 = new ToolTip();
        Tooltip1.ToolTipIcon = toolTipIcon;
        Tooltip1.Active = true;
        Tooltip1.IsBalloon = true;
        Tooltip1.ToolTipTitle = "Info";
        Tooltip1.ForeColor = foreColor;
        Tooltip1.BackColor = backColor;
        Tooltip1.SetToolTip(control, message);
        Tooltip1.AutoPopDelay = 0;
        Tooltip1.Show(message, control, 1000);
    }
    #endregion

}
